<div id="fiche">
    <?php if($sf_user->hasRelPermission("edit_fiche", $ktd_character_fiche->getKTDCharacter()->getKTDPlayer())): ?>
    <a class="btn primary" href="<?php echo url_for("edit_fiche", $ktd_character_fiche) ?>">Editer</a>
    <?php endif; ?>
    <?php if($sf_user->hasRelPermission("delete_character", $ktd_character_fiche->getKTDCharacter()->getKTDPlayer())): ?>
    <a onclick="return confirm('Supprimer le personnage ?')" class="btn danger" href="<?php echo url_for("delete_character", $ktd_character_fiche->getKTDCharacter())?>">Supprimer</a>
    <?php endif; ?>
     <?php if($sf_user->hasPermission("validate_character")): ?>
    <a class="btn success" href="<?php echo url_for("validate_character", $ktd_character_fiche->getKTDCharacter())?>"><?php echo $ktd_character_fiche->getKTDCharacter()->getIsValid() ? 'Dévalider' : 'Valider' ?></a>
    <?php endif; ?>
    <?php if($sf_user->hasRelPermission("edit_character", $ktd_character_fiche->getKTDCharacter()->getKTDPlayer())): ?>
    <a class="btn success" href="<?php echo url_for("edit_character", $ktd_character_fiche->getKTDCharacter())?>">Réglages</a>
    <?php endif; ?>
    <div class="cat"><img src="/images/mgen/icon/pastille.png" style="vertical-align: top"><h1>Fiche de <?php echo link_to($ktd_character_fiche->getKTDCharacter()->getPseudo(), "show_character", $ktd_character_fiche->getKTDCharacter()) ?></h1></div>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="lf">
                <div class="avatar-bubble">
                    <div class="avatar" style="background-image: url(<?php echo $ktd_character_fiche->getKTDCharacter()->getAvatar() ?>)"></div>
                    <div class="name daniel-font"><?php echo $ktd_character_fiche->getKTDCharacter()->getPseudo() ?></div>
                </div>
            </div>
            <div class="rg">
                <h2 class="sonic-title-font cat">etat civil</h2>
                <div class="inter-message bw-marble">
                    <div class="<?php echo $ktd_character_fiche->getKTDCharacter()->getIsValid()? 'validation-seal': '' ?>">
                        <span data-bind="text: characterFirstName" class="bold"><span style="font-size: 6px;"class="sonic-title-font">prenom </span></span><span class="bold black"> <?php echo $ktd_character_fiche->getFirstName() ?></span><br/><br/>
                        <span data-bind="text: characterName" class="bold"><span style="font-size: 6px;"class="sonic-title-font">nom </span></span><span class="bold black"> <?php echo $ktd_character_fiche->getName() ?></span><br/><br/>
                        <span data-bind="text: characterAge" class="bold"><span style="font-size: 6px;"class="sonic-title-font">age </span></span><span class="bold black"><?php echo $ktd_character_fiche->getAge() ?></span> <br/><br/>
                        <span data-bind="text: characterAlignement" class="bold"><span style="font-size: 6px;"class="sonic-title-font">alignement </span></span><span class="bold black"> <?php echo $ktd_character_fiche->getAlignement() ?></span> <br/><br/>
                        <span data-bind="text: characterRace" class="bold"><span style="font-size: 6px;"class="sonic-title-font">race </span></span><span class="bold black"> <?php echo $ktd_character_fiche->getRace() ?></span> <br/>
                    </div>
            </div>
        </div>
    </div>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="one-row">
                <h2 class="sonic-title-font cat">histoire</h2>
                <div class="inter-message bw-marble">
                    <p data-bind="text: characterStory">
                        <?php echo KTDCodeParser::getSingleton()->getParsedText($ktd_character_fiche->getStory(ESC_RAW)) ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="one-row">
                <h2 class="sonic-title-font cat">psychologie</h2>
                <div class="inter-message bw-marble">
                    <p data-bind="text: characterMindDesc">
                        <?php echo KTDCodeParser::getSingleton()->getParsedText($ktd_character_fiche->getMindDesc(ESC_RAW)) ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="one-row">
                <h2 class="sonic-title-font cat">apparence</h2>
                <div class="inter-message bw-marble">
                    <p data-bind="text: characterPhyDesc">
                        <?php echo KTDCodeParser::getSingleton()->getParsedText($ktd_character_fiche->getPhyDesc(ESC_RAW)) ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <?php if($ktd_character_fiche->getPnj()!= ''): ?>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="one-row">
                <h2 class="sonic-title-font cat">personnages non jouables</h2>
                <div class="inter-message bw-marble">
                    <p data-bind="text: characterPNJ">
                        <?php echo KTDCodeParser::getSingleton()->getParsedText($ktd_character_fiche->getPNJ(ESC_RAW)) ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>
    <?php if($ktd_character_fiche->getOther() != ''): ?>
    <div class="message-cadre">
        <div class="ext-message">
            <div class="one-row">
                <h2 class="sonic-title-font cat">autre</h2>
                <div class="inter-message bw-marble">
                    <p data-bind="text: characterOther">
                        <?php echo KTDCodeParser::getSingleton()->getParsedText($ktd_character_fiche->getOther(ESC_RAW)) ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>
</div>
</div>
<hr />
<a class="btn valid" href="<?php echo url_for("post_fiche_comment",$ktd_character_fiche->getKTDCharacter()); ?>">Poster un commentaire</a>
<?php foreach($ktd_character_fiche->getKTDCharacter()->getFicheComments() as $comment): ?>
<div class="comment-cadre message-cadre">
    <div class="ext-message">
    <div class="lf">
        <div class="avatar-bubble">
            <div class="avatar" style="background-image: url(<?php echo $comment->getKTDPlayer()->getAvatar() ?>)"></div>
            <div class="name daniel-font"><?php echo link_to($comment->getKTDPlayer()->getPseudo(), "show_player", $comment->getKTDPlayer()) ?></div>
        </div>
    </div>
    <div class="rg">
        <div class="inter-message"><?php echo KTDCodeParser::getSingleton()->getParsedText($comment->getBody(ESC_RAW), true) ?></div>
        <div class="message-info">Posté le <?php echo $comment->getCreatedAt() ?></div>
    </div>
    </div>
</div>
<?php endforeach; ?>
<script type="text/javascript">
    var c = KTDCharacter.convertArrayToModelView(
                <?php
                    echo KillTheDragon::convertToJSArray(
                            $ktd_character_fiche->getKTDCharacter()->generateArrayToConvertToMMVM()
                            )
                 ?>);
    ko.applyBindings(c);
</script>
